home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / interfaces / PInterface Translator / PInterfaces / new Script.p < prev    next >
Encoding:
Text File  |  1993-09-16  |  30.8 KB  |  940 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Script.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Script;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingScript}
  22. {$SETC UsingScript := 1}
  23.  
  24. {$I+}
  25. {$SETC ScriptIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingQuickdraw}
  31. {$I $$Shell(PInterfaces)Quickdraw.p}
  32. {$ENDC}
  33. {$IFC UNDEFINED UsingIntlResources}
  34. {$I $$Shell(PInterfaces)IntlResources.p}
  35. {$ENDC}
  36. {$SETC UsingIncludes := ScriptIncludes}
  37.  
  38. CONST
  39.  
  40. { Script System constants }
  41.  
  42. smSystemScript = -1;                    {designates system script.}
  43. smCurrentScript = -2;                    {designates current font script.}
  44. smAllScripts = -3;                        {designates any script}
  45.  
  46. smRoman = 0;                            {Roman}
  47. smJapanese = 1;                            {Japanese}
  48. smTradChinese = 2;                        {Traditional Chinese}
  49. smKorean = 3;                            {Korean}
  50. smArabic = 4;                            {Arabic}
  51. smHebrew = 5;                            {Hebrew}
  52. smGreek = 6;                            {Greek}
  53. smCyrillic = 7;                            {Cyrillic}
  54. smRSymbol = 8;                            {Right-left symbol}
  55. smDevanagari = 9;                        {Devanagari}
  56. smGurmukhi = 10;                        {Gurmukhi}
  57. smGujarati = 11;                        {Gujarati}
  58. smOriya = 12;                            {Oriya}
  59. smBengali = 13;                            {Bengali}
  60. smTamil = 14;                            {Tamil}
  61. smTelugu = 15;                            {Telugu}
  62. smKannada = 16;                            {Kannada/Kanarese}
  63. smMalayalam = 17;                        {Malayalam}
  64. smSinhalese = 18;                        {Sinhalese}
  65. smBurmese = 19;                            {Burmese}
  66. smKhmer = 20;                            {Khmer/Cambodian}
  67. smThai = 21;                            {Thai}
  68. smLaotian = 22;                            {Laotian}
  69. smGeorgian = 23;                        {Georgian}
  70. smArmenian = 24;                        {Armenian}
  71. smSimpChinese = 25;                        {Simplified Chinese}
  72. smTibetan = 26;                            {Tibetan}
  73. smMongolian = 27;                        {Mongolian}
  74. smGeez = 28;                            {Geez/Ethiopic}
  75. smEthiopic = 28;                        {Synonym for smGeez}
  76. smEastEurRoman = 29;                    {Synonym for smSlavic}
  77. smVietnamese = 30;                        {Vietnamese}
  78. smExtArabic = 31;                        {extended Arabic}
  79. smUninterp = 32;                        {uninterpreted symbols, e.g. palette symbols}
  80. smKlingon = 32;                            {Klingon}
  81.  
  82.  
  83. {Obsolete names for script systems (kept for backward compatibility)}
  84.  
  85. smChinese = 2;                            {(use smTradChinese or smSimpChinese)}
  86. smRussian = 7;                            {(old name for smCyrillic)}
  87.  
  88.  
  89. { smMaldivian = 25;         (no more smMaldivian!)}
  90.  
  91. smAmharic = 28;                            {(old name for smGeez)}
  92. smSlavic = 29;                            {(old name for smEastEurRoman)}
  93. smSindhi = 31;                            {(old name for smExtArabic)}
  94.  
  95.  
  96. { Language Codes }
  97.  
  98. langEnglish = 0;                        { smRoman script }
  99. langFrench = 1;                            { smRoman script }
  100. langGerman = 2;                            { smRoman script }
  101. langItalian = 3;                        { smRoman script }
  102. langDutch = 4;                            { smRoman script }
  103. langSwedish = 5;                        { smRoman script }
  104. langSpanish = 6;                        { smRoman script }
  105. langDanish = 7;                            { smRoman script }
  106. langPortuguese = 8;                        { smRoman script }
  107. langNorwegian = 9;                        { smRoman script }
  108. langHebrew = 10;                        { smHebrew script }
  109. langJapanese = 11;                        { smJapanese script }
  110. langArabic = 12;                        { smArabic script }
  111. langFinnish = 13;                        { smRoman script }
  112. langGreek = 14;                            { smGreek script }
  113. langIcelandic = 15;                        { extended Roman script }
  114. langMaltese = 16;                        { extended Roman script }
  115. langTurkish = 17;                        { extended Roman script }
  116. langCroatian = 18;                        { Serbo-Croatian in extended Roman script }
  117. langTradChinese = 19;                    { Chinese in traditional characters }
  118. langUrdu = 20;                            { smArabic script }
  119. langHindi = 21;                            { smDevanagari script }
  120. langThai = 22;                            { smThai script }
  121. langKorean = 23;                        { smKorean script }
  122. langLithuanian = 24;                    { smEastEurRoman script }
  123. langPolish = 25;                        { smEastEurRoman script }
  124. langHungarian = 26;                        { smEastEurRoman script }
  125. langEstonian = 27;                        { smEastEurRoman script }
  126. langLettish = 28;                        { smEastEurRoman script }
  127. langLatvian = 28;                        { Synonym for langLettish }
  128. langLapponian = 29;                        { extended Roman script }
  129. langLappish = 29;                        { Synonym for langLapponian }
  130. langFaeroese = 30;                        { smRoman script }
  131. langFarsi = 31;                            { smArabic script }
  132. langPersian = 31;                        { Synonym for langFarsi }
  133. langRussian = 32;                        { smCyrillic script }
  134. langSimpChinese = 33;                    { Chinese in simplified characters }
  135. langFlemish = 34;                        { smRoman script }
  136. langIrish = 35;                            { smRoman script }
  137. langAlbanian = 36;                        { smRoman script }
  138. langRomanian = 37;                        { smEastEurRoman script }
  139. langCzech = 38;                            { smEastEurRoman script }
  140. langSlovak = 39;                        { smEastEurRoman script }
  141. langSlovenian = 40;                        { smEastEurRoman script }
  142. langYiddish = 41;                        { smHebrew script }
  143. langSerbian = 42;                        { Serbo-Croatian in smCyrillic script }
  144. langMacedonian = 43;                    { smCyrillic script }
  145. langBulgarian = 44;                        { smCyrillic script }
  146. langUkrainian = 45;                        { smCyrillic script }
  147. langByelorussian = 46;                    { smCyrillic script }
  148. langUzbek = 47;                            { smCyrillic script }
  149. langKazakh = 48;                        { smCyrillic script }
  150. langAzerbaijani = 49;                    { Azerbaijani in smCyrillic script (USSR) }
  151. langAzerbaijanAr = 50;                    { Azerbaijani in smArabic script (Iran) }
  152. langArmenian = 51;                        { smArmenian script }
  153. langGeorgian = 52;                        { smGeorgian script }
  154. langMoldavian = 53;                        { smCyrillic script }
  155. langKirghiz = 54;                        { smCyrillic script }
  156. langTajiki = 55;                        { smCyrillic script }
  157. langTurkmen = 56;                        { smCyrillic script }
  158. langMongolian = 57;                        { Mongolian in smMongolian script }
  159. langMongolianCyr = 58;                    { Mongolian in smCyrillic script }
  160. langPashto = 59;                        { smArabic script }
  161. langKurdish = 60;                        { smArabic script }
  162. langKashmiri = 61;                        { smArabic script }
  163. langSindhi = 62;                        { smExtArabic script }
  164. langTibetan = 63;                        { smTibetan script }
  165. langNepali = 64;                        { smDevanagari script }
  166. langSanskrit = 65;                        { smDevanagari script }
  167. langMarathi = 66;                        { smDevanagari script }
  168. langBengali = 67;                        { smBengali script }
  169. langAssamese = 68;                        { smBengali script }
  170. langGujarati = 69;                        { smGujarati script }
  171. langPunjabi = 70;                        { smGurmukhi script }
  172. langOriya = 71;                            { smOriya script }
  173. langMalayalam = 72;                        { smMalayalam script }
  174. langKannada = 73;                        { smKannada script }
  175. langTamil = 74;                            { smTamil script }
  176. langTelugu = 75;                        { smTelugu script }
  177. langSinhalese = 76;                        { smSinhalese script }
  178. langBurmese = 77;                        { smBurmese script }
  179. langKhmer = 78;                            { smKhmer script }
  180. langLao = 79;                            { smLaotian script }
  181. langVietnamese = 80;                    { smVietnamese script }
  182. langIndonesian = 81;                    { smRoman script }
  183. langTagalog = 82;                        { smRoman script }
  184. langMalayRoman = 83;                    { Malay in smRoman script }
  185. langMalayArabic = 84;                    { Malay in smArabic script }
  186. langAmharic = 85;                        { smEthiopic script }
  187. langTigrinya = 86;                        { smEthiopic script }
  188. langGalla = 87;                            { smEthiopic script }
  189. langOromo = 87;                            { Synonym for langGalla }
  190. langSomali = 88;                        { smRoman script }
  191. langSwahili = 89;                        { smRoman script }
  192. langRuanda = 90;                        { smRoman script }
  193. langRundi = 91;                            { smRoman script }
  194. langChewa = 92;                            { smRoman script }
  195. langMalagasy = 93;                        { smRoman script }
  196. langEsperanto = 94;                        { extended Roman script }
  197. langWelsh = 128;                        { smRoman script }
  198. langBasque = 129;                        { smRoman script }
  199. langCatalan = 130;                        { smRoman script }
  200. langLatin = 131;                        { smRoman script }
  201. langQuechua = 132;                        { smRoman script }
  202. langGuarani = 133;                        { smRoman script }
  203. langAymara = 134;                        { smRoman script }
  204. langTatar = 135;                        { smCyrillic script }
  205. langUighur = 136;                        { smArabic script }
  206. langDzongkha = 137;                        { (lang of Bhutan) smTibetan script }
  207. langJavaneseRom = 138;                    { Javanese in smRoman script }
  208. langSundaneseRom = 139;                    { Sundanese in smRoman script }
  209.  
  210.  
  211. { Obsolete names, kept for backward compatibility }
  212.  
  213. langPortugese = 8;                        { old misspelled version, kept for compatibility }
  214. langMalta = 16;                            { old misspelled version, kept for compatibility }
  215. langYugoslavian = 18;                    { (use langCroatian, langSerbian, etc.) }
  216. langChinese = 19;                        { (use langTradChinese or langSimpChinese) }
  217.  
  218.  
  219.  
  220. { Regional version codes }
  221.  
  222. verUS = 0;
  223. verFrance = 1;
  224. verBritain = 2;
  225. verGermany = 3;
  226. verItaly = 4;
  227. verNetherlands = 5;
  228. verFrBelgiumLux = 6;                    { French for Belgium & Luxembourg }
  229. verSweden = 7;
  230. verSpain = 8;
  231. verDenmark = 9;
  232. verPortugal = 10;
  233. verFrCanada = 11;
  234. verNorway = 12;
  235. verIsrael = 13;
  236. verJapan = 14;
  237. verAustralia = 15;
  238. verArabic = 16;                            { synonym for verArabia }
  239. verFinland = 17;
  240. verFrSwiss = 18;                        { French Swiss }
  241. verGrSwiss = 19;                        { German Swiss }
  242. verGreece = 20;
  243. verIceland = 21;
  244. verMalta = 22;
  245. verCyprus = 23;
  246. verTurkey = 24;
  247. verYugoCroatian = 25;                    { Croatian system for Yugoslavia }
  248. verIndiaHindi = 33;                        { Hindi system for India }
  249. verPakistan = 34;
  250. verLithuania = 41;
  251. verPoland = 42;
  252. verHungary = 43;
  253. verEstonia = 44;
  254. verLatvia = 45;
  255. verLapland = 46;
  256. verFaeroeIsl = 47;
  257. verIran = 48;
  258. verRussia = 49;
  259. verIreland = 50;                        { English-language version for Ireland }
  260. verKorea = 51;
  261. verChina = 52;
  262. verTaiwan = 53;
  263. verThailand = 54;
  264.  
  265. minCountry = verUS;
  266. maxCountry = verThailand;
  267.  
  268.  
  269. {Obsolete region code names, kept for backward compatibility}
  270.  
  271.  
  272. verBelgiumLux = 6;                        { (use verFrBelgiumLux instead, less ambiguous) }
  273. verArabia = 16;
  274. verYugoslavia = 25;                        { (use verYugoCroatian instead, less ambiguous) }
  275. verIndia = 33;                            { (use verIndiaHindi instead, less ambiguous) }
  276.  
  277.  
  278. { Calendar Codes }
  279.  
  280. calGregorian = 0;
  281. calArabicCivil = 1;
  282. calArabicLunar = 2;
  283. calJapanese = 3;
  284. calJewish = 4;
  285. calCoptic = 5;
  286. calPersian = 6;
  287.  
  288.  
  289. { Integer Format Codes }
  290.  
  291. intWestern = 0;
  292. intArabic = 1;
  293. intRoman = 2;
  294. intJapanese = 3;
  295. intEuropean = 4;
  296. intOutputMask = $8000;
  297.  
  298.  
  299. { CharByte byte types }
  300.  
  301. smSingleByte = 0;
  302. smFirstByte = -1;
  303. smLastByte = 1;
  304. smMiddleByte = 2;
  305.  
  306.  
  307. { CharType field masks }
  308.  
  309. smcTypeMask = $000F;
  310. smcReserved = $00F0;
  311. smcClassMask = $0F00;
  312. smcOrientationMask = $1000;                {two-byte script glyph orientation}
  313. smcRightMask = $2000;
  314. smcUpperMask = $4000;
  315. smcDoubleMask = $8000;
  316.  
  317.  
  318. { Basic CharType character types }
  319.  
  320. smCharPunct = $0000;
  321. smCharAscii = $0001;
  322. smCharEuro = $0007;
  323. smCharExtAscii = $0007;                    { More correct synonym for smCharEuro }
  324.  
  325.  
  326. { Additional CharType character types for script systems }
  327.  
  328. smCharKatakana = $0002;                    {Japanese Katakana}
  329. smCharHiragana = $0003;                    {Japanese Hiragana}
  330. smCharIdeographic = $0004;                {Hanzi, Kanji, Hanja}
  331. smCharTwoByteGreek = $0005;                {2-byte Greek in Far East systems}
  332. smCharTwoByteRussian = $0006;            {2-byte Cyrillic in Far East systems}
  333. smCharBidirect = $0008;                    {Arabic/Hebrew}
  334. smCharContextualLR = $0009;                {Contextual left-right: Thai, Indic scripts}
  335. smCharNonContextualLR = $000A;            {Non-contextual left-right: Cyrillic, Greek}
  336. smCharHangul = $000C;                    {Korean Hangul}
  337. smCharJamo = $000D;                        {Korean Jamo}
  338. smCharBopomofo = $000E;                    {Chinese Bopomofo}
  339.  
  340.  
  341. { old names for some of above, for backward compatibility }
  342.  
  343. smCharFISKana = $0002;                    {Katakana}
  344. smCharFISGana = $0003;                    {Hiragana}
  345. smCharFISIdeo = $0004;                    {Hanzi, Kanji, Hanja}
  346. smCharFISGreek = $0005;                    {2-byte Greek in Far East systems}
  347. smCharFISRussian = $0006;                {2-byte Cyrillic in Far East systems}
  348.  
  349.  
  350. { CharType classes for punctuation (smCharPunct) }
  351.  
  352. smPunctNormal = $0000;
  353. smPunctNumber = $0100;
  354. smPunctSymbol = $0200;
  355. smPunctBlank = $0300;
  356.  
  357.  
  358. { Additional CharType classes for punctuation in two-byte systems }
  359.  
  360. smPunctRepeat = $0400;                    { repeat marker }
  361. smPunctGraphic = $0500;                    { line graphics }
  362.  
  363.  
  364. { CharType Katakana and Hiragana classes for two-byte systems }
  365.  
  366. smKanaSmall = $0100;                    {small kana character}
  367. smKanaHardOK = $0200;                    {can have dakuten}
  368. smKanaSoftOK = $0300;                    {can have dakuten or han-dakuten}
  369.  
  370.  
  371. { CharType Ideographic classes for two-byte systems }
  372.  
  373. smIdeographicLevel1 = $0000;            {level 1 char}
  374. smIdeographicLevel2 = $0100;            {level 2 char}
  375. smIdeographicUser = $0200;                {user char}
  376.  
  377.  
  378. { old names for above, for backward compatibility }
  379.  
  380. smFISClassLvl1 = $0000;                    {level 1 char}
  381. smFISClassLvl2 = $0100;                    {level 2 char}
  382. smFISClassUser = $0200;                    {user char}
  383.  
  384.  
  385. { CharType Jamo classes for Korean systems }
  386.  
  387. smJamoJaeum = $0000;                    {simple consonant char}
  388. smJamoBogJaeum = $0100;                    {complex consonant char}
  389. smJamoMoeum = $0200;                    {simple vowel char}
  390. smJamoBogMoeum = $0300;                    {complex vowel char}
  391.  
  392.  
  393. { CharType glyph orientation for two-byte systems }
  394.  
  395. smCharHorizontal = $0000;                { horizontal character form, or for both }
  396. smCharVertical = $1000;                    { vertical character form }
  397.  
  398.  
  399. { CharType directions }
  400.  
  401. smCharLeft = $0000;
  402. smCharRight = $2000;
  403.  
  404.  
  405. { CharType case modifers }
  406.  
  407. smCharLower = $0000;
  408. smCharUpper = $4000;
  409.  
  410.  
  411. { CharType character size modifiers (1 or multiple bytes). }
  412.  
  413. smChar1byte = $0000;
  414. smChar2byte = $8000;
  415.  
  416.  
  417. { TransliterateText target types for Roman }
  418.  
  419. smTransAscii = 0;                        {convert to ASCII}
  420. smTransNative = 1;                        {convert to font script}
  421. smTransCase = $FE;                        {convert case for all text}
  422. smTransSystem = $FF;                    {convert to system script}
  423.  
  424.  
  425. { TransliterateText target types for two-byte scripts }
  426.  
  427. smTransAscii1 = 2;                        {1-byte Roman}
  428. smTransAscii2 = 3;                        {2-byte Roman}
  429. smTransKana1 = 4;                        {1-byte Japanese Katakana}
  430. smTransKana2 = 5;                        {2-byte Japanese Katakana}
  431. smTransGana2 = 7;                        {2-byte Japanese Hiragana (no 1-byte Hiragana)}
  432. smTransHangul2 = 8;                        {2-byte Korean Hangul}
  433. smTransJamo2 = 9;                        {2-byte Korean Jamo}
  434. smTransBopomofo2 = 10;                    {2-byte Chinese Bopomofo}
  435.  
  436.  
  437. { TransliterateText target modifiers }
  438.  
  439. smTransLower = $4000;                    {target becomes lowercase}
  440. smTransUpper = $8000;                    {target becomes uppercase}
  441.  
  442.  
  443. { TransliterateText resource format numbers }
  444.  
  445. smTransRuleBaseFormat = 1;                {Rule based trsl resource format }
  446. smTransHangulFormat = 2;                {Table based Hangul trsl resource format}
  447.  
  448.  
  449. { TransliterateText property flags }
  450.  
  451. smTransPreDoubleByting = 1;                {Convert all text to double byte before transliteration}
  452. smTransPreLowerCasing = 2;                {Convert all text to lower case before transliteration}
  453.  
  454.  
  455. { TransliterateText source mask - general }
  456.  
  457. smMaskAll = $FFFFFFFF;                    {Convert all text}
  458.  
  459.  
  460. { TransliterateText source masks }
  461.  
  462. smMaskAscii = $00000001;                {2^smTransAscii}
  463. smMaskNative = $00000002;                {2^smTransNative}
  464.  
  465.  
  466. { TransliterateText source masks for two-byte scripts }
  467.  
  468. smMaskAscii1 = $00000004;                {2^smTransAscii1}
  469. smMaskAscii2 = $00000008;                {2^smTransAscii2}
  470. smMaskKana1 = $00000010;                {2^smTransKana1}
  471. smMaskKana2 = $00000020;                {2^smTransKana2}
  472. smMaskGana2 = $00000080;                {2^smTransGana2}
  473. smMaskHangul2 = $00000100;                {2^smTransHangul2}
  474. smMaskJamo2 = $00000200;                {2^smTransJamo2}
  475. smMaskBopomofo2 = $00000400;            {2^smTransBopomofo2}
  476.  
  477.  
  478. { Result values from GetSMVariable, SetSMVariable, GetScriptVariable and SetScriptVariable calls. }
  479.  
  480. smNotInstalled = 0;                        {routine not available in script}
  481. smBadVerb = -1;                            {Bad verb passed to a routine}
  482. smBadScript = -2;                        {Bad script code passed to a routine}
  483.  
  484.  
  485. { Values for script redraw flag. }
  486.  
  487. smRedrawChar = 0;                        {Redraw character only}
  488. smRedrawWord = 1;                        {Redraw entire word (2-byte systems)}
  489. smRedrawLine = -1;                        {Redraw entire line (bidirectional systems)}
  490.  
  491.  
  492. { GetSMVariable and SetSMVariable verbs }
  493.  
  494. smVersion = 0;                            {Script Manager version number}
  495. smMunged = 2;                            {Globals change count}
  496. smEnabled = 4;                            {Count of enabled scripts, incl Roman}
  497. smBidirect = 6;                            {At least one bidirectional script}
  498. smFontForce = 8;                        {Force font flag}
  499. smIntlForce = 10;                        {Force intl flag}
  500. smForced = 12;                            {Script was forced to system script}
  501. smDefault = 14;                            {Script was defaulted to Roman script}
  502. smPrint = 16;                            {Printer action routine}
  503. smSysScript = 18;                        {System script}
  504. smLastScript = 20;                        {Last keyboard script}
  505. smKeyScript = 22;                        {Keyboard script}
  506. smSysRef = 24;                            {System folder refNum}
  507. smKeyCache = 26;                        {obsolete}
  508. smKeySwap = 28;                            {Swapping table handle}
  509. smGenFlags = 30;                        {General flags long}
  510. smOverride = 32;                        {Script override flags}
  511. smCharPortion = 34;                        {Ch vs SpExtra proportion}
  512.  
  513.  
  514. { New for System 7.0: }
  515.  
  516. smDoubleByte = 36;                        {Flag for double-byte script installed}
  517. smKCHRCache = 38;                        {Returns pointer to KCHR cache}
  518. smRegionCode = 40;                        {Returns current region code (verXxx)}
  519. smKeyDisableState = 42;                    {Returns current keyboard disable state}
  520.  
  521.  
  522. { GetScriptVariable and SetScriptVariable verbs.
  523. Note: Verbs private to script systems are negative, while
  524. those general across script systems are non-negative. }
  525.  
  526. smScriptVersion = 0;                    {Script software version}
  527. smScriptMunged = 2;                        {Script entry changed count}
  528. smScriptEnabled = 4;                    {Script enabled flag}
  529. smScriptRight = 6;                        {Right to left flag}
  530. smScriptJust = 8;                        {Justification flag}
  531. smScriptRedraw = 10;                    {Word redraw flag}
  532. smScriptSysFond = 12;                    {Preferred system font}
  533. smScriptAppFond = 14;                    {Preferred Application font}
  534. smScriptBundle = 16;                    {Beginning of itlb verbs}
  535. smScriptNumber = 16;                    {Script itl0 id}
  536. smScriptDate = 18;                        {Script itl1 id}
  537. smScriptSort = 20;                        {Script itl2 id}
  538. smScriptFlags = 22;                        {flags word}
  539. smScriptToken = 24;                        {Script itl4 id}
  540. smScriptEncoding = 26;                    {id of optional itl5, if present}
  541. smScriptLang = 28;                        {Current language for script}
  542. smScriptNumDate = 30;                    {Script Number/Date formats.}
  543. smScriptKeys = 32;                        {Script KCHR id}
  544. smScriptIcon = 34;                        {ID # of SICN or kcs#/kcs4/kcs8 suite}
  545. smScriptPrint = 36;                        {Script printer action routine}
  546. smScriptTrap = 38;                        {Trap entry pointer}
  547. smScriptCreator = 40;                    {Script file creator}
  548. smScriptFile = 42;                        {Script file name}
  549. smScriptName = 44;                        {Script name}
  550.  
  551.  
  552. { There is a hole here for old Kanji private verbs 46-76 
  553.  
  554.  New for System 7.0: }
  555.  
  556. smScriptMonoFondSize = 78;                {default monospace FOND (hi) & size (lo)}
  557. smScriptPrefFondSize = 80;                {preferred FOND (hi) & size (lo)}
  558. smScriptSmallFondSize = 82;                {default small FOND (hi) & size (lo)}
  559. smScriptSysFondSize = 84;                {default system FOND (hi) & size (lo)}
  560. smScriptAppFondSize = 86;                {default app FOND (hi) & size (lo)}
  561. smScriptHelpFondSize = 88;                {default Help Mgr FOND (hi) & size (lo)}
  562. smScriptValidStyles = 90;                {mask of valid styles for script}
  563. smScriptAliasStyle = 92;                {style (set) to use for aliases}
  564.  
  565.  
  566. { Special script code values for International Utilities }
  567.  
  568. iuSystemScript = -1;                    { <obsolete>  system script }
  569. iuCurrentScript = -2;                    { <obsolete>  current script (for font of grafPort) }
  570.  
  571.  
  572. { Negative verbs for KeyScript }
  573.  
  574. smKeyNextScript = -1;                    { Switch to next available script }
  575. smKeySysScript = -2;                    { Switch to the system script }
  576. smKeySwapScript = -3;                    { Switch to previously-used script }
  577.  
  578.  
  579. { New for System 7.0: }
  580.  
  581. smKeyNextKybd = -4;                        { Switch to next keyboard in current keyscript }
  582. smKeySwapKybd = -5;                        { Switch to previously-used keyboard in current keyscript }
  583.  
  584. smKeyDisableKybds = -6;                    { Disable keyboards not in system or Roman script }
  585. smKeyEnableKybds = -7;                    { Re-enable keyboards for all enabled scripts }
  586. smKeyToggleInline = -8;                    { Toggle inline input for current keyscript }
  587. smKeyToggleDirection = -9;                { Toggle default line direction (TESysJust) }
  588. smKeyNextInputMethod = -10;                { Switch to next input method in current keyscript }
  589. smKeySwapInputMethod = -11;                { Switch to last-used input method in current keyscript }
  590.  
  591. smKeyDisableKybdSwitch = -12;            { Disable switching from the current keyboard }
  592.  
  593. smKeySetDirLeftRight = -15;                { Set default line dir to left-right, align left }
  594. smKeySetDirRightLeft = -16;                { Set default line dir to right-left, align right }
  595. smKeyRoman = -17;                        { Set keyscript to Roman. Does nothing if Roman-only
  596.                                         system, unlike KeyScript(smRoman) which forces
  597.                                         an update to current default Roman keyboard }
  598.  
  599.  
  600. { Bits in the smScriptFlags word
  601. (bits above 8 are non-static) }
  602.  
  603. smsfIntellCP = 0;                        {Script has intelligent cut & paste}
  604. smsfSingByte = 1;                        {Script has only single bytes}
  605. smsfNatCase = 2;                        {Native chars have upper & lower case}
  606. smsfContext = 3;                        {Script is contextual}
  607. smsfNoForceFont = 4;                    {Script will not force characters}
  608. smsfB0Digits = 5;                        {Script has alternate digits at B0-B9}
  609. smsfAutoInit = 6;                        {Auto initialize the script}
  610. smsfUnivExt = 7;                        {Script is handled by universal extension}
  611. smsfSynchUnstyledTE    = 8;                {Script synchronizes for unstyled TE}
  612. smsfForms = 13;                            {Uses contextual forms for letters}
  613. smsfLigatures = 14;                        {Uses contextual ligatures}
  614. smsfReverse = 15;                        {Reverses native text, right-left}
  615.  
  616.  
  617. { Bits in the smGenFlags long.
  618. First (high-order) byte is set from itlc flags byte. }
  619.  
  620. smfShowIcon = 31;                        {Show icon even if only one script}
  621. smfDualCaret = 30;                        {Use dual caret for mixed direction text}
  622. smfNameTagEnab = 29;                    {Reserved for internal use}
  623. smfUseAssocFontInfo = 28;                {Use the associated font info for FontMetrics calls }
  624.  
  625.  
  626.  
  627. { Roman script constants 
  628.  
  629.  The following are here for backward compatibility, but should not be used. 
  630.  This information should be obtained using GetScript. }
  631.  
  632. romanSysFond = $3FFF;                    {system font id number}
  633. romanAppFond = 3;                        {application font id number}
  634. romanFlags = $0007;                        {roman settings}
  635.  
  636.  
  637. { Script Manager font equates. }
  638.  
  639. smFondStart = $4000;                    {start from 16K}
  640. smFondEnd = $C000;                        {past end of range at 48K}
  641.  
  642.  
  643. { Miscellaneous font equates. }
  644.  
  645. smUprHalfCharSet = $80;                    {first char code in top half of std char set}
  646.  
  647.  
  648. { Character Set Extensions }
  649.  
  650. diaeresisUprY = $D9;
  651. fraction = $DA;
  652. intlCurrency = $DB;
  653. leftSingGuillemet = $DC;
  654. rightSingGuillemet = $DD;
  655. fiLigature = $DE;
  656. flLigature = $DF;
  657. dblDagger = $E0;
  658. centeredDot = $E1;
  659. baseSingQuote = $E2;
  660. baseDblQuote = $E3;
  661. perThousand = $E4;
  662. circumflexUprA = $E5;
  663. circumflexUprE = $E6;
  664. acuteUprA = $E7;
  665. diaeresisUprE = $E8;
  666. graveUprE = $E9;
  667. acuteUprI = $EA;
  668. circumflexUprI = $EB;
  669. diaeresisUprI = $EC;
  670. graveUprI = $ED;
  671. acuteUprO = $EE;
  672. circumflexUprO = $EF;
  673. appleLogo = $F0;
  674. graveUprO = $F1;
  675. acuteUprU = $F2;
  676. circumflexUprU = $F3;
  677. graveUprU = $F4;
  678. dotlessLwrI = $F5;
  679. circumflex = $F6;
  680. tilde = $F7;
  681. macron = $F8;
  682. breveMark = $F9;
  683. overDot = $FA;
  684. ringMark = $FB;
  685. cedilla = $FC;
  686. doubleAcute = $FD;
  687. ogonek = $FE;
  688. hachek = $FF;
  689.  
  690. { TokenType values }
  691.  
  692. tokenIntl = 4;                            {the itl resource number of the tokenizer}
  693. tokenEmpty = -1;                        {used internally as an empty flag}
  694. tokenUnknown = 0;                        {chars that do not match a defined token type}
  695. tokenWhite = 1;                            {white space}
  696. tokenLeftLit = 2;                        {literal begin}
  697. tokenRightLit = 3;                        {literal end}
  698. tokenAlpha = 4;                            {alphabetic}
  699. tokenNumeric = 5;                        {numeric}
  700. tokenNewLine = 6;                        {new line}
  701. tokenLeftComment = 7;                    {open comment}
  702. tokenRightComment = 8;                    {close comment}
  703. tokenLiteral = 9;                        {literal}
  704. tokenEscape = 10;                        {character escape (e.g. '\' in "\n", "\t")}
  705. tokenAltNum = 11;                        {alternate number (e.g. $B0-B9 in Arabic,Hebrew)}
  706. tokenRealNum = 12;                        {real number}
  707. tokenAltReal = 13;                        {alternate real number}
  708. tokenReserve1 = 14;                        {reserved}
  709. tokenReserve2 = 15;                        {reserved}
  710. tokenLeftParen = 16;                    {open parenthesis}
  711. tokenRightParen = 17;                    {close parenthesis}
  712. tokenLeftBracket = 18;                    {open square bracket}
  713. tokenRightBracket = 19;                    {close square bracket}
  714. tokenLeftCurly = 20;                    {open curly bracket}
  715. tokenRightCurly = 21;                    {close curly bracket}
  716. tokenLeftEnclose = 22;                    {open guillemet}
  717. tokenRightEnclose = 23;                    {close guillemet}
  718. tokenPlus = 24;
  719. tokenMinus = 25;
  720. tokenAsterisk = 26;                        {times/multiply}
  721. tokenDivide = 27;
  722. tokenPlusMinus = 28;                    {plus or minus symbol}
  723. tokenSlash = 29;
  724. tokenBackSlash = 30;
  725. tokenLess = 31;                            {less than symbol}
  726. tokenGreat = 32;                        {greater than symbol}
  727. tokenEqual = 33;
  728. tokenLessEqual2 = 34;                    {less than or equal, 2 characters (e.g. <=)}
  729. tokenLessEqual1 = 35;                    {less than or equal, 1 character}
  730. tokenGreatEqual2 = 36;                    {greater than or equal, 2 characters (e.g. >=)}
  731. tokenGreatEqual1 = 37;                    {greater than or equal, 1 character}
  732. token2Equal = 38;                        {double equal (e.g. ==)}
  733. tokenColonEqual = 39;                    {colon equal}
  734. tokenNotEqual = 40;                        {not equal, 1 character}
  735. tokenLessGreat = 41;                    {less/greater, Pascal not equal (e.g. <>)}
  736. tokenExclamEqual = 42;                    {exclamation equal, C not equal (e.g. !=)}
  737. tokenExclam = 43;                        {exclamation point}
  738. tokenTilde = 44;                        {centered tilde}
  739. tokenComma = 45;
  740. tokenPeriod = 46;
  741. tokenLeft2Quote = 47;                    {open double quote}
  742. tokenRight2Quote = 48;                    {close double quote}
  743. tokenLeft1Quote = 49;                    {open single quote}
  744. tokenRight1Quote = 50;                    {close single quote}
  745. token2Quote = 51;                        {double quote}
  746. token1Quote = 52;                        {single quote}
  747. tokenSemicolon = 53;
  748. tokenPercent = 54;
  749. tokenCaret = 55;
  750. tokenUnderline = 56;
  751. tokenAmpersand = 57;
  752. tokenAtSign = 58;
  753. tokenBar = 59;                            {vertical bar}
  754. tokenQuestion = 60;
  755. tokenPi = 61;                            {lower-case pi}
  756. tokenRoot = 62;                            {square root symbol}
  757. tokenSigma = 63;                        {capital sigma}
  758. tokenIntegral = 64;                        {integral sign}
  759. tokenMicro = 65;
  760. tokenCapPi = 66;                        {capital pi}
  761. tokenInfinity = 67;
  762. tokenColon = 68;
  763. tokenHash = 69;                            {e.g. #}
  764. tokenDollar = 70;
  765. tokenNoBreakSpace = 71;                    {non-breaking space}
  766. tokenFraction = 72;
  767. tokenIntlCurrency = 73;
  768. tokenLeftSingGuillemet = 74;
  769. tokenRightSingGuillemet = 75;
  770. tokenPerThousand = 76;
  771. tokenEllipsis = 77;
  772. tokenCenterDot = 78;
  773. tokenNil = 127;
  774. delimPad = -2;
  775.  
  776. { obsolete, misspelled token names kept for backward compatibility }
  777.  
  778. tokenTilda = 44;
  779. tokenCarat = 55;
  780.  
  781.  
  782. { Table selectors for GetItlTable }
  783.  
  784. smWordSelectTable = 0;                    { get word select break table from 'itl2' }
  785. smWordWrapTable = 1;                    { get word wrap break table from 'itl2' }
  786. smNumberPartsTable = 2;                    { get default number parts table from 'itl4' }
  787. smUnTokenTable = 3;                        { get unToken table from 'itl4' }
  788. smWhiteSpaceList = 4;                    { get white space list from 'itl4' }
  789.  
  790. iuWordSelectTable = 0;                    { <obsolete>  get word select break table from 'itl2' }
  791. iuWordWrapTable = 1;                    { <obsolete>  get word wrap break table from 'itl2' }
  792. iuNumberPartsTable = 2;                    { <obsolete>  get default number parts table from 'itl4' }
  793. iuUnTokenTable = 3;                        { <obsolete>  get unToken table from 'itl4' }
  794. iuWhiteSpaceList = 4;                    { <obsolete>  get white space list from 'itl4' }
  795.  
  796. TYPE
  797. TokenResults = (tokenOK,tokenOverflow,stringOverflow,badDelim,badEnding,
  798.  crash);
  799.  
  800.  
  801. CharByteTable = PACKED ARRAY [0..255] OF SignedByte;
  802.  
  803. TokenType = INTEGER;
  804. DelimType = ARRAY [0..1] OF TokenType;
  805. CommentType = ARRAY [0..3] OF TokenType;
  806.  
  807. TokenRecPtr = ^TokenRec;
  808. TokenRec = RECORD
  809.  theToken: TokenType;
  810.  position: Ptr;                            {pointer into original source}
  811.  length: LONGINT;                        {length of text in original source}
  812.  stringPosition: StringPtr;                {Pascal/C string copy of identifier}
  813.  END;
  814.  
  815. TokenBlockPtr = ^TokenBlock;
  816. TokenBlock = RECORD
  817.  source: Ptr;                            {pointer to stream of characters}
  818.  sourceLength: LONGINT;                    {length of source stream}
  819.  tokenList: Ptr;                        {pointer to array of tokens}
  820.  tokenLength: LONGINT;                    {maximum length of TokenList}
  821.  tokenCount: LONGINT;                    {number tokens generated by tokenizer}
  822.  stringList: Ptr;                        {pointer to stream of identifiers}
  823.  stringLength: LONGINT;                    {length of string list}
  824.  stringCount: LONGINT;                    {number of bytes currently used}
  825.  doString: BOOLEAN;                        {make strings & put into StringList}
  826.  doAppend: BOOLEAN;                        {append to TokenList rather than replace}
  827.  doAlphanumeric: BOOLEAN;                {identifiers may include numeric}
  828.  doNest: BOOLEAN;                        {do comments nest?}
  829.  leftDelims: ARRAY [0..1] OF TokenType;
  830.  rightDelims: ARRAY [0..1] OF TokenType;
  831.  leftComment: ARRAY [0..3] OF TokenType;
  832.  rightComment: ARRAY [0..3] OF TokenType;
  833.  escapeCode: TokenType;                    {escape symbol code}
  834.  decimalCode: TokenType;
  835.  itlResource: Handle;                    {handle to itl4 resource of current script}
  836.  reserved: ARRAY [0..7] OF LONGINT;        {must be zero!}
  837.  END;
  838.  
  839.  
  840. FUNCTION FontScript: INTEGER;
  841.  INLINE $2F3C,$8200,$0000,$A8B5;
  842. FUNCTION IntlScript: INTEGER;
  843.  INLINE $2F3C,$8200,$0002,$A8B5;
  844. PROCEDURE KeyScript(code: INTEGER);
  845.  INLINE $2F3C,$8002,$0004,$A8B5;
  846. FUNCTION CharByte(textBuf: Ptr;textOffset: INTEGER): INTEGER;
  847.  INLINE $2F3C,$8206,$0010,$A8B5;
  848. FUNCTION CharType(textBuf: Ptr;textOffset: INTEGER): INTEGER;
  849.  INLINE $2F3C,$8206,$0012,$A8B5;
  850. FUNCTION Transliterate(srcHandle: Handle;dstHandle: Handle;target: INTEGER;
  851.  srcMask: LONGINT): OSErr;
  852.  INLINE $2F3C,$820E,$0018,$A8B5;
  853. FUNCTION ParseTable(VAR table: CharByteTable): BOOLEAN;
  854.  INLINE $2F3C,$8204,$0022,$A8B5;
  855. FUNCTION GetSysDirection: INTEGER;
  856.  INLINE $3EB8,$0BAC;
  857. FUNCTION GetSysJust: INTEGER;
  858.  INLINE $3EB8,$0BAC;
  859. PROCEDURE SetSysDirection(newDirection: INTEGER);
  860.  INLINE $31DF,$0BAC;
  861. PROCEDURE SetSysJust(newJust: INTEGER);
  862.  INLINE $31DF,$0BAC;
  863.  
  864. FUNCTION IntlTokenize(tokenParam: TokenBlockPtr): TokenResults;
  865.  INLINE $2F3C,$8204,$FFFA,$A8B5;
  866. FUNCTION FontToScript(fontNumber: INTEGER): INTEGER;
  867.  INLINE $2F3C,$8202,$0006,$A8B5;
  868. FUNCTION Font2Script(fontNumber: INTEGER): INTEGER;
  869.  INLINE $2F3C,$8202,$0006,$A8B5;
  870. FUNCTION GetSMVariable(selector: INTEGER): LONGINT;
  871.  INLINE $2F3C,$8402,$0008,$A8B5;
  872. FUNCTION GetEnvirons(verb: INTEGER): LONGINT;
  873.  INLINE $2F3C,$8402,$0008,$A8B5;
  874. FUNCTION SetSMVariable(selector: INTEGER;param: LONGINT): OSErr;
  875.  INLINE $2F3C,$8206,$000A,$A8B5;
  876. FUNCTION SetEnvirons(verb: INTEGER;param: LONGINT): OSErr;
  877.  INLINE $2F3C,$8206,$000A,$A8B5;
  878. FUNCTION GetScriptVariable(script: INTEGER;selector: INTEGER): LONGINT;
  879.  INLINE $2F3C,$8404,$000C,$A8B5;
  880. FUNCTION GetScript(script: INTEGER;verb: INTEGER): LONGINT;
  881.  INLINE $2F3C,$8404,$000C,$A8B5;
  882. FUNCTION SetScriptVariable(script: INTEGER;selector: INTEGER;param: LONGINT): OSErr;
  883.  INLINE $2F3C,$8208,$000E,$A8B5;
  884. FUNCTION SetScript(script: INTEGER;verb: INTEGER;param: LONGINT): OSErr;
  885.  INLINE $2F3C,$8208,$000E,$A8B5;
  886.  
  887.  
  888.  
  889. {  New for 7.1  }
  890.  
  891. FUNCTION GetScriptUtilityAddress(selector: INTEGER;Before: BOOLEAN;script: ScriptCode): Ptr;
  892.  INLINE $2F3C,$C404,$0038,$A8B5;
  893. PROCEDURE SetScriptUtilityAddress(selector: INTEGER;Before: BOOLEAN;routineAddr: Ptr;
  894.  script: ScriptCode);
  895.  INLINE $2F3C,$C008,$003A,$A8B5;
  896. FUNCTION GetScriptQDPatchAddress(trapNum: INTEGER;Before: BOOLEAN;forPrinting: BOOLEAN;
  897.  script: ScriptCode): Ptr;
  898.  INLINE $2F3C,$C406,$003C,$A8B5;
  899. PROCEDURE SetScriptQDPatchAddress(trapNum: INTEGER;Before: BOOLEAN;forPrinting: BOOLEAN;
  900.  routineAddr: Ptr;script: ScriptCode);
  901.  INLINE $2F3C,$C00A,$003E,$A8B5;
  902.  
  903. FUNCTION CharacterByteType(textBuf: Ptr;textOffset: INTEGER;script: ScriptCode): INTEGER;
  904.  INLINE $2F3C,$C206,$0010,$A8B5;
  905. FUNCTION CharacterType(textBuf: Ptr;textOffset: INTEGER;script: ScriptCode): INTEGER;
  906.  INLINE $2F3C,$C206,$0012,$A8B5;
  907. FUNCTION TransliterateText(srcHandle: Handle;dstHandle: Handle;target: INTEGER;
  908.  srcMask: LONGINT;script: ScriptCode): OSErr;
  909.  INLINE $2F3C,$C20E,$0018,$A8B5;
  910. FUNCTION FillParseTable(VAR table: CharByteTable;script: ScriptCode): BOOLEAN;
  911.  INLINE $2F3C,$C204,$0022,$A8B5;
  912.  
  913. {  Moved from packages.p  }
  914.  
  915. FUNCTION GetIntlResource(theID: INTEGER): Handle;
  916.  INLINE $3F3C,$0006,$A9ED;
  917. FUNCTION IUGetIntl(theID: INTEGER): Handle;
  918.  INLINE $3F3C,$0006,$A9ED;
  919. PROCEDURE IUSetIntl(refNum: INTEGER;theID: INTEGER;intlHandle: Handle);
  920.  INLINE $3F3C,$0008,$A9ED;
  921. PROCEDURE ClearIntlResourceCache;
  922.  INLINE $3F3C,$0018,$A9ED;
  923. PROCEDURE IUClearCache;
  924.  INLINE $3F3C,$0018,$A9ED;
  925.  
  926. PROCEDURE GetIntlResourceTable(script: ScriptCode;tableCode: INTEGER;VAR itlHandle: Handle;
  927.  VAR offset: LONGINT;VAR length: LONGINT);
  928.  INLINE $3F3C,$0024,$A9ED;
  929. PROCEDURE IUGetItlTable(script: ScriptCode;tableCode: INTEGER;VAR itlHandle: Handle;
  930.  VAR offset: LONGINT;VAR length: LONGINT);
  931.  INLINE $3F3C,$0024,$A9ED;
  932.  
  933.  
  934. {$ENDC} { UsingScript }
  935.  
  936. {$IFC NOT UsingIncludes}
  937.  END.
  938. {$ENDC}
  939.  
  940.